//
//  YKStorageItemCell.m
//  YunKang
//
//  Created by leoking870 on 2017/11/2.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import <SDWebImage/UIImageView+WebCache.h>
#import "YKStorageItemCell.h"
#import "YKStorageItem.h"
#import "YKStorageModel.h"

@interface YKStorageItemCell ()
@property (weak, nonatomic) IBOutlet UIImageView *drugImageView;
@property (weak, nonatomic) IBOutlet UILabel *drugNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *drugPackageLabel;
@property (weak, nonatomic) IBOutlet UILabel *drugFactoryLabel;
@property (weak, nonatomic) IBOutlet UILabel *drugPriceLabel;

@end

@implementation YKStorageItemCell
@dynamic tableViewItem;
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)cellWillAppear {
    [super cellWillAppear];
    if(self.tableViewItem.model.FACE_PIC1){
        [self.drugImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://yunkangmall.njnwyy.com:8084%@",self.tableViewItem.model.FACE_PIC1]] placeholderImage:[UIImage imageNamed:@"icon_loading"] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
            if(error){
                self.drugImageView.image = [UIImage imageNamed:@"icon_fail"];
            }
        }];
    }
    else {
        self.drugImageView.image = [UIImage imageNamed:@"icon_fail"];
    }
    self.drugNameLabel.text = self.tableViewItem.model.GENERIC_NAME;
    self.drugPackageLabel.text = self.tableViewItem.model.CPACKINGTYPE;
    self.drugFactoryLabel.text = self.tableViewItem.model.CENTERPRISE;
    self.drugPriceLabel.text = self.tableViewItem.model.ISAFE_NUM;
}

@end
